﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using csLTDMC;
using DMC300Axis_IO.Function;


namespace DMC300Axis_IO.Function
{
    public class Initial_Card
    {
        public static void DMC300_InitialClass()
        {
            
            DMC300_Info.ExistCard = LTDMC.dmc_board_init(); //取得PC上有几张DMC300卡
            if(DMC300_Info.ExistCard <= 0 || DMC300_Info.ExistCard > 8)
            {
                MessageBox.Show("初始卡失败!", "出错");
            }
            ushort usNum = 0;
            ushort[] arrusCardList = new ushort[8];
            uint[] arrunCardTypes = new uint[8];
            short sRtn = LTDMC.dmc_get_CardInfList(ref usNum, arrunCardTypes, arrusCardList);
            if (sRtn != 0)
            {
                MessageBox.Show("获取卡信息失败!");
            }
            for(int i = 0;i < DMC300_Info.ExistCard;i++)
            {
                DMC300_Info.usCardId[i] = arrusCardList[i];  //将控制卡序号规整到公用参数上
            }
            
        }
    }
}
